]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-screenshot: Avoid a crash when the cursor texture is NULL
authorRui Matos <tiagomatos@gmail.com>
Mon, 19 Sep 2016 13:34:03 +0000 (15:34 +0200)
committerRui Matos <tiagomatos@gmail.com>
Mon, 19 Sep 2016 20:41:51 +0000 (22:41 +0200)
Analogously to commit 2a7f9f70b836aee8605876186ff75d001d8ce63d for the
screen recorder, as a wayland compositor, the cursor texture might not
exist.

https://bugzilla.gnome.org/show_bug.cgi?id=771656

src/shell-screenshot.c

index 089828e05313dde891c7edf2c058071cfb61469f..0e5e69d8f6c57c63f9d71a1ad1b128c020954d9c 100644 (file)
@@ -263,6 +263,10 @@ _draw_cursor_image (MetaCursorTracker     *tracker,
   int x, y;
   int xhot, yhot;
 
+  texture = meta_cursor_tracker_get_sprite (tracker);
+  if (!texture)
+    return;
+
   screenshot_region = cairo_region_create_rectangle (&area);
   meta_cursor_tracker_get_pointer (tracker, &x, &y, NULL);
 
@@ -272,7 +276,6 @@ _draw_cursor_image (MetaCursorTracker     *tracker,
       return;
     }
 
-  texture = meta_cursor_tracker_get_sprite (tracker);
   meta_cursor_tracker_get_hot (tracker, &xhot, &yhot);
   width = cogl_texture_get_width (texture);
   height = cogl_texture_get_height (texture);